﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgNetComponents.Classes
{
    /// <summary>
    /// Class to save object with itstypes
    /// </summary>
    public class TypedObjectCollection
    {
        /// <summary>
        /// types
        /// </summary>
        private List<Type> types = new List<Type>();
        /// <summary>
        /// objects
        /// </summary>
        private List<object> objects = new List<object>();

        /// <summary>
        /// Adds an obejct and its type to collection
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value">The value.</param>
        public void Add<T>(T value)
        {
            types.Add(typeof(T));
            objects.Add(value);
        }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        public void AddRange<T1, T2>(T1 value1, T2 value2) { Add(value1); Add(value2); }

        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        public void AddRange<T1, T2, T3>(T1 value1, T2 value2, T3 value3) { Add(value1); Add(value2); Add(value3); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        public void AddRange<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4) { Add(value1); Add(value2); Add(value3); Add(value4); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        public void AddRange<T1, T2, T3, T4, T5>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <typeparam name="T6">The type of the 6.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        /// <param name="value6">The value6.</param>
        public void AddRange<T1, T2, T3, T4, T5, T6>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); Add(value6); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <typeparam name="T6">The type of the 6.</typeparam>
        /// <typeparam name="T7">The type of the 7.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        /// <param name="value6">The value6.</param>
        /// <param name="value7">The value7.</param>
        public void AddRange<T1, T2, T3, T4, T5, T6, T7>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); Add(value6); Add(value7); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <typeparam name="T6">The type of the 6.</typeparam>
        /// <typeparam name="T7">The type of the 7.</typeparam>
        /// <typeparam name="T8">The type of the 8.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        /// <param name="value6">The value6.</param>
        /// <param name="value7">The value7.</param>
        /// <param name="value8">The value8.</param>
        public void AddRange<T1, T2, T3, T4, T5, T6, T7, T8>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); Add(value6); Add(value7); Add(value8); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <typeparam name="T6">The type of the 6.</typeparam>
        /// <typeparam name="T7">The type of the 7.</typeparam>
        /// <typeparam name="T8">The type of the 8.</typeparam>
        /// <typeparam name="T9">The type of the 9.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        /// <param name="value6">The value6.</param>
        /// <param name="value7">The value7.</param>
        /// <param name="value8">The value8.</param>
        /// <param name="value9">The value9.</param>
        public void AddRange<T1, T2, T3, T4, T5, T6, T7, T8, T9>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); Add(value6); Add(value7); Add(value8); Add(value9); }
        /// <summary>
        /// Adds obejcts and their types to collections
        /// </summary>
        /// <typeparam name="T1">The type of the 1.</typeparam>
        /// <typeparam name="T2">The type of the 2.</typeparam>
        /// <typeparam name="T3">The type of the 3.</typeparam>
        /// <typeparam name="T4">The type of the 4.</typeparam>
        /// <typeparam name="T5">The type of the 5.</typeparam>
        /// <typeparam name="T6">The type of the 6.</typeparam>
        /// <typeparam name="T7">The type of the 7.</typeparam>
        /// <typeparam name="T8">The type of the 8.</typeparam>
        /// <typeparam name="T9">The type of the 9.</typeparam>
        /// <typeparam name="T10">The type of the 10.</typeparam>
        /// <param name="value1">The value1.</param>
        /// <param name="value2">The value2.</param>
        /// <param name="value3">The value3.</param>
        /// <param name="value4">The value4.</param>
        /// <param name="value5">The value5.</param>
        /// <param name="value6">The value6.</param>
        /// <param name="value7">The value7.</param>
        /// <param name="value8">The value8.</param>
        /// <param name="value9">The value9.</param>
        /// <param name="value10">The value10.</param>
        public void AddRange<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10) { Add(value1); Add(value2); Add(value3); Add(value4); Add(value5); Add(value6); Add(value7); Add(value8); Add(value9); Add(value10); }
        /// <summary>
        /// Gets all objects added to collection
        /// </summary>
        /// <value>
        /// The objects.
        /// </value>
        public object[] Objects
        {
            get { return objects.ToArray(); }
        }
        /// <summary>
        /// Gets all obejct types added to collection
        /// </summary>
        /// <value>
        /// The types.
        /// </value>
        public Type[] Types
        {
            get { return types.ToArray(); }
        }
    }
}
